package qc.module.duty.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import qc.module.duty.dto.schedule.DutyScheduleInfoDto;
import qc.module.duty.dto.schedule.DutyScheduleShiftSetDto;
import qc.module.duty.entity.DutySchedule;

import java.util.List;


@Mapper
public interface DutyScheduleMapper {
    DutyScheduleMapper MAPPER = Mappers.getMapper(DutyScheduleMapper.class);

    @Mapping(target = "gid", ignore = true)
    @Mapping(target = "begintm", source = "begintm", dateFormat = "yyyy-MM-dd ")
    @Mapping(target = "endtm", source = "endtm", dateFormat = "yyyy-MM-dd ")
    @Mapping(target = "intm", ignore = true)
    DutySchedule toEntity(DutyScheduleShiftSetDto dto);


    @Mapping(target = "groupid", source = "gid")
    @Mapping(target = "begintm", source = "begintm", dateFormat = "yyyy-MM-dd ")
    @Mapping(target = "endtm", source = "endtm", dateFormat = "yyyy-MM-dd ")
    @Mapping(target = "intm", source = "intm", dateFormat = "yyyy-MM-dd ")
    DutyScheduleInfoDto toScheduleInfoDto(DutySchedule en);
    List<DutyScheduleInfoDto> toScheduleInfoDtoList(List<DutySchedule> list);

}
